import service from '@/utils/request'
import type {
  GetArtistHotsongsListResponse,
  GetArtistAlbumsListResponse,
  GetRelatedMvResponse,
  GetArtistDescResponse,
  GetSimiArtistResponse,
} from './modules/singerDetailModel'

enum Api {}
/*
 *******歌手详情******
 注：关于offset，你可以这样理解，假设你当前的歌单有100首歌
你传入limit=10&offset=0等价于limit=10，你会得到第1-10首歌曲
你传入limit=10&offset=1，你会得到第2-11首歌曲
如果你设置limit=10&offset=2，你就会得到第3-12首歌曲
 */
// 歌手详情
export const reqArtistDetail = ({ id = '' }) => {
  return service.get<any, any>(`/artist/detail?id=${id}`)
}
// 歌手热门歌曲
export const reqArtistHotsongs = (id: string) => {
  return service.get<any, GetArtistHotsongsListResponse>(
    `/artist/top/song?id=${id}`
  )
}
// 获取歌手专辑
export const reqArtistAlbums = ({ id = '', limit = 12, offset = 0 }) => {
  return service.get<any, GetArtistAlbumsListResponse>(
    `/artist/album?id=${id}&limit=${limit}&offset=${offset}`,
    {}
  )
}
// 获取歌手 mv
export const reqArtistMv = ({ id = '', limit = 50, offset = 0 }) => {
  return service.get<any, GetRelatedMvResponse>(
    `/artist/mv?id=${id}&limit=${limit}&offset=${offset}`,
    {}
  )
}
// 歌手介绍
export const reqArtistDesc = ({ id = '' }) => {
  return service.get<any, GetArtistDescResponse>(`/artist/desc?id=${id}`, {})
}
// 相似歌手
export const reqSimiArtist = ({ id = '' }) => {
  return service.get<any, GetSimiArtistResponse>(`/simi/artist?id=${id}`, {})
}
// 收藏/取消收藏歌手
export const artistSub = ({ id = '', t = '1' }) => {
  return service.get(`/artist/sub?id=${id}&t=${t}`, {})
}
// 收藏的歌手列表
export const subArtist = () => {
  return service.get('/artist/sublist', {})
}

/* ********* MV ********* */
// 获取 mv
export const mv = ({
  area = '',
  type = '',
  order = '',
  limit = 50,
  offset = 0,
}) => {
  return service.get(
    `/mv/all?area=${area}&type=${type}&order=${order}&limit=${limit}&offset=${offset}`,
    {}
  )
}
// 获取 mv详情
export const mvDetail = ({ id = '' }) => {
  return service.get(`/mv/detail?mvid=${id}`, {})
}
// 获取 地址
export const mvUrl = ({ id = '', r = 1080 }) => {
  return service.get(`/mv/url?id=${id}&r=${r}`, {})
}
// 获取mv评论
export const commentMv = ({
  id = '',
  limit = 20,
  offset = 0,
  before = 0,
  timestamp = 0,
}) => {
  return service.get(
    `/comment/mv?id=${id}&limit=${limit}&offset=${offset}&before=${before}&timestamp=${timestamp}`,
    {}
  )
}
// 相似mv
export const simiMv = ({ id = '' }) => {
  return service.get(`/simi/mv?mvid=${id}`, {})
}
